// Type consversion constructor.
// 	1. There is only one parameter.
// 	2. The parameter is't the same with class name.

#include <iostream>
using namespace std;

class Cat {
	public:
		Cat( const char* name ): m_name( name ) {
		
		}
		void talk( ) {
			cout << m_name << " : miao~~" << endl;
		}
	private:
		string m_name;
		friend class Dog;
};

class Dog {
	public:
		Dog( const char* name ): m_name( name ) {
		
		}
		// Without this constructor, you can't convert
		// You can' implicit convert when you use the key word "explicit"
		// You must coercion when you are using explicit
		explicit Dog( const Cat& that ) : m_name( that.m_name ) {
			cout << "Called" << endl;
		}
		void talk( ) {
			cout << m_name << " : wang wang wang" << endl;
		}
	private:
		string m_name;
};

// designer
// ------------------------------------------------------------------
// user

int main( void ) { 
	Cat smallwhite( "xiaobai" );
	smallwhite.talk( );

	// Dog bigyellow( smallwhite );
	Dog bigyellow = static_cast<Dog>(smallwhite);	// Define anonymous objects
					// Dog biteyellow = anonymous objects of cat
	bigyellow.talk( );


	return 0;
}

